package cn.edu.nju.ws.sview.reasoning.test;

import java.util.ArrayList;
import java.util.List;

import cn.edu.nju.ws.ocr.api.Coref;
import cn.edu.nju.ws.ocr.util.Inst;
import cn.edu.nju.ws.sview.cache.URIIDCache;
import cn.edu.nju.ws.sview.crawler.Crawler;
import cn.edu.nju.ws.sview.crawler.Element;
import cn.edu.nju.ws.sview.database.DBOperations;
import cn.edu.nju.ws.sview.rdf.ResourceFactory;
import cn.edu.nju.ws.sview.rdf.URIResource;
import cn.edu.nju.ws.sview.views.Entity;

public class datatest {
	
	public static String removeParams(String url, String param) { 
		String reg = null; 
		StringBuffer ps = new StringBuffer();
		ps.append("("); 
			ps.append(param); 
		ps.append(")"); 
		reg = "(?<=[\\?&])" + ps.toString() + "=[^&]*&?"; 
		url = url.replaceAll(reg, "");
		url = url.replaceAll("(\\?|&+)$", "");
		return url; 
	} 
	
	public static void test(ArrayList<String> list){
		list.get(1);
		System.out.println("fuck you");
	}
   public static void main(String[] args) {
	   System.out.println(Entity.getNameByEntityID(368, "zh"));
//	   String str = "http://rdf.freebase.com/rdf/en.titanic";
//	   int entityID = 0;
//	try {
//		entityID = URIIDCache.getInstance().getURIID(str, true);
//	} catch (Throwable e1) {
//		// TODO Auto-generated catch block
//		e1.printStackTrace();
//	}
//	   URIResource resource = ResourceFactory.getInstance().createURIResource(str);
//      {
//		 Crawler.getInstance().submitURI(resource) ; 
//		 Crawler.getInstance().promoteWeight(resource, Element.HIGH_WEIGHT);
//		 boolean wait = true;
//		 while(wait){
//			 wait = false;
//		     if(Crawler.getInstance().checkStatus(resource)!=Crawler.STATUS_DONE)
//		    	 wait = true;
//		     try {
//				Thread.sleep(50);
//			} catch (InterruptedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		 }
//	 }
//	 String status = DBOperations.getSuccessStatus(entityID);
//	 
//	 if(!status.equals(URIResource.VALID_SUCCEED)){
//		 System.out.println(false);
//	 }else{
//		System.out.println(true);
//	 }
		 
 }
}
